package Java攻略._3_流式操作._5_利用peek方法对流进行调试;

import java.util.stream.IntStream;

public class _33_添加标识映射以便打印 {

    public static void main(String[] args) {

        _33_添加标识映射以便打印 _33 = new _33_添加标识映射以便打印();
        int sum = _33.sumDoubleDivisbleBy3(1, 6);
        System.out.println(sum);
    }

    public int sumDoubleDivisbleBy3(int start, int end){
        return IntStream.rangeClosed(start, end)
                .map(n -> {
                    System.out.print(n + " ");
                    return n;
                })
                .map(n -> n * 2)
                .filter(n -> n % 3 == 0)
                .sum();
    }
}
